<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>user</title>
    <link rel="stylesheet" href="/Trees/LayUiBac/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-container">
    <div class="layui-row">
        <form class="layui-form" action="">
            <div class="layui-form-item">
                <label class="layui-form-label">用户名称</label>
                <div class="layui-input-block">
                    <input type="text" name="userName" required lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">真实姓名</label>
                <div class="layui-input-block">
                    <input type="text" name="realname" required lay-verify="required"
                           autocomplete="off" class="layui-input">
                </div>
            </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">类别</label>
                    <div class="layui-input-block">
                        <select name="level" lay-verify="required" id ="medicType">
                            <option value="2">仓库等级用户</option>
                            <option value="1">资料等级用户</option>
                            <option value="0">最高级别用户</option>

                        </select>
                    </div>
                </div>
                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">密码</label>
                    <div class="layui-input-block">
                        <input type="text" id="password1" name="password" required lay-verify="required"
                               autocomplete="off" class="layui-input">
                    </div>
                    <label class="layui-form-label">再次确认密码</label>
                    <div class="layui-input-block">
                        <input type="text" id="password2" name="password" required lay-verify="required"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>
        </form>

    </div>
</div>


<script src="/Trees/LayUiBac/layui/layui.js"></script>
<script>
    //Demo
    layui.use('form', function () {
        let form = layui.form;
        let $ = layui.$;

        $('#password2').on('mouseleave',function (){
            if($('#password2').val()!==$('#password1').val()){
                alert("你的两次密码输入有误差");
            }
        })

        //监听提交
        form.on('submit(formDemo)', function (data) {
            layer.msg(JSON.stringify(data.field));
            return false;
        });
    });
</script>
</body>
</html>